/*
 * Copyright (c) 2016 zhangcm. All Rights Reserved.
 */
package com.jnzc.ocr.serv.shop.api.impl;

import com.jnzc.ocr.common.bean.PageResult;
import com.jnzc.ocr.serv.shop.api.ShopProductCategoryApi;
import com.jnzc.ocr.serv.shop.entity.ShopProductCategory;
import com.jnzc.ocr.serv.shop.filter.ShopProductCategoryFilter;
import com.jnzc.ocr.serv.shop.service.ShopProductCategoryService;
import com.jnzc.ocr.serv.shop.vo.ShopProductCategorySaveVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhangcm
 * @version 1.0, 2017/9/13
 */
@RestController
public class ShopProductCategoryApiImpl implements ShopProductCategoryApi {

    @Autowired
    private ShopProductCategoryService shopProductCategoryService;

    @Override
    public ShopProductCategory find(@RequestParam("id") Long id, @RequestParam("shopId") Long shopId) {
        return shopProductCategoryService.find(id, shopId);
    }

    @Override
    public List<ShopProductCategory> list(@RequestBody ShopProductCategoryFilter filter) {
        return shopProductCategoryService.list(filter);
    }

    @Override
    public PageResult<ShopProductCategory> search(@RequestBody ShopProductCategoryFilter filter, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) {
        return shopProductCategoryService.search(filter, pageNo, pageSize);
    }

    @Override
    public void save(@RequestBody ShopProductCategorySaveVo param, Long shopId) {
        shopProductCategoryService.save(param, shopId);
    }

    @Override
    public void delete(@RequestParam("id") Long id, @RequestParam("shopId") Long shopId) {
        shopProductCategoryService.delete(id, shopId);
    }
}
